package model;

import java.io.Serializable;

import javax.sound.sampled.AudioFormat;

public class Signal implements Serializable {
/**
	 * 
	 */
	private static final long serialVersionUID = 4853601422837383536L;


	private EnumSignalType msgType;
	private AudioFormatWrapper format;
	private int udpListening;
	private String lastName;
	private String firstName;
	private ChatMessage chatMsg;
	
	
	public Signal(EnumSignalType type){
		this.msgType = type;
	}
	
	public Signal(){
		
	}
	
	public void factorySignalCallRequest(int udpImGonnaUse, AudioFormatWrapper audioImGonnaUse, String firstName, String lastName){
		//que doit-on envoyer quand on demande un appel ?
		//le port UDP sur lequel on travaille
		//son nom, son prenom
		//le port TCP pas besoin car il l'aura dans la socket
		this.msgType=EnumSignalType.CALL_REQUEST;
		this.udpListening=udpImGonnaUse;
		this.format=audioImGonnaUse;
		this.firstName=firstName;
		this.lastName=lastName;
	}
	
	public void factorySignalCallAccept(int udpImGonnaUse,String firstName, String lastName){
		this.msgType=EnumSignalType.CALL_ACCEPT;
		this.udpListening=udpImGonnaUse;
		this.firstName=firstName;
		this.lastName=lastName;
		
	}
	
		public EnumSignalType getMsgType() {
		return msgType;
	}

		public AudioFormatWrapper getAudioWrapper() {
			return format;
		}

		public int getUdpListening() {
			return udpListening;
		}

		public String getLastName() {
			return lastName;
		}

		public String getFirstName() {
			return firstName;
		}

		public void factorySignalSendChatMsg(ChatMessage chatMessage) {
			this.msgType=EnumSignalType.CALL_CHAT_MSG;
			this.chatMsg=chatMessage;
			
		}

		public ChatMessage getChatMsg() {
			return chatMsg;
		}

		public void factorySignalCallEnd() {
			this.msgType=EnumSignalType.CALL_END;
			}
		
		
		public void factorySignalCallPauseOn() {
			this.msgType=EnumSignalType.CALL_PAUSE_ON;
		}
		

		public void factorySignalCallPauseOff() {
			this.msgType=EnumSignalType.CALL_PAUSE_OFF;
		}

		public void factorySinalDenyCall() {
			this.msgType=EnumSignalType.CALL_REFUSE;
			
		}

		public void factorySignalCallEndOk() {
			this.msgType=EnumSignalType.CALL_END_OK;
			
		}
	
}
